def func_out():
	num = 10

	def func_inner():
		nonlocal num # 告诉解释器需要修改函数外的变量，不是修改全局变量
		num = 20
		result = num + 30
		print(result)

	print("num:", num)
	func_inner()
	print("num:", num)

	return func_inner

closure = func_out()
closure()